#ifndef _ISOCKET_H_
#define _ISOCKET_H_
//author:xda
//date:2008-10-19

unsigned int Resolve(const char* addr);

struct _declspec(novtable) ISocket
{
	virtual bool Create() = 0;
	virtual bool Shutdown() = 0;
	virtual bool Close() = 0;
	virtual bool Bind( const int nPort,const bool bLocalOnly = false ) = 0;
	virtual bool Connect( const char* addr,const int nPort ) = 0;
	virtual bool Listen() = 0;
	virtual ISocket* Accept() = 0;
	virtual char* GetPeerName() = 0;
	virtual char* GetSockName() = 0;
	virtual bool SetTimeout( unsigned int secs ) = 0;

	virtual int Send( const char* buffer,const int nLen ) = 0;
	virtual int SendQueued( const char* buffer,const int nLen ) = 0;
	virtual int Read( char* buffer,const int nLen ) = 0;

	virtual bool SendExact( const char *buffer, const int nLen ) = 0;
	virtual bool SendExact(const char *buffer, const int nLen, unsigned char msgType) = 0; // sf@2002 - DSMPlugin
    virtual bool SendExactQueue(const char *buffer, const int nLen) = 0;
    virtual bool ReadExact(char *buffer, const int nLen) = 0;
    virtual void ClearQueue();

   // sf@2002 - DSMPlugin
   // virtual void SetDSMPluginPointer(CDSMPlugin* pDSMPlugin) = 0;
   // virtual void EnableUsePlugin(bool fEnable) = 0;
   // virtual bool IsUsePluginEnabled(void) = 0;
   // virtual void SetWriteToNetRectBuffer(bool fEnable)  = 0; 
   // virtual bool GetWriteToNetRectBuffer(void)  = 0;
   // virtual int  GetNetRectBufOffset(void) = 0;
   // virtual void SetNetRectBufOffset(int nValue)  = 0;
   // virtual unsigned char* GetNetRectBuf(void)  = 0;
   // virtual void CheckNetRectBufferSize(int nBufSize);
   // virtual bool SendExactHTTP(const char *buff, const int nLen);
   // virtual bool ReadExactHTTP(char *buff, const int nLen);
}


#endif